package edu.uaskl.jqf.playground;

import edu.uaskl.jqf.model.gates.util.Gates;
import edu.uaskl.jqf.model.math.ContinuedFraction;
import edu.uaskl.jqf.model.matrix.MatrixComplex;

public class _tbachFinished {
    public static void main(final String[] args) {
        testEntropy();
    }

    public static void demonstrationFraction() {
        final double number = 73.0 / 11;
        final ContinuedFraction cf = new ContinuedFraction(number);
        System.out.println("number orig: " + number);
        System.out.println("number get : " + cf.getNumber());
        System.out.println("number calc : " + ((1.0 * cf.getNumerator()) / cf.getDenominator()));
        System.out.println("cf list: " + cf.getContinuedFractionList());
        System.out.println(cf);
    }

    public static void testEntropy() {
        // In a d-dimensional Hilbert space the entropy is at most log d. The entropy is
        // equal to log d if and only if the system is in the completely mixed state I/d.
        // nielson, chuang, S513
        final int d = 8;
        final MatrixComplex identity = Gates.IDENTITY.getSize(d);
        final MatrixComplex result = identity.multiply(1.0 / d);
        System.out.println(result.getEntropy());
        System.out.println("log(d): " + Math.log(d));
        System.out.println();
        System.out.println(result.getEntropyToLogBase(2));
    }
}
